<template>
  <div>
    <el-card class="box-card">
      <div class="add-btn">
        <el-button type="primary" icon="el-icon-edit" size="small" @click="switchAddDialog"
          >添加</el-button
        >
      </div>
      <!-- 表格组件 -->
      <menu-table ref="mychild" />
    <add-dialog :openAddDialog="openAddDialog" @closeDialog="switchAddDialog"  @refresh="refreshHandle" />
    </el-card>
  </div>
</template>

<script>
import menuTable from './components/menu-table.vue'
import addDialog from './components/add-dialog.vue'
export default {
  components: { menuTable, addDialog },
  data() {
    return {
      openAddDialog: {
        switch: false
      },
      menuList: []
    }
  },
  methods: {
    switchAddDialog() {
      this.openAddDialog.switch = !this.openAddDialog.switch
    },
    refreshHandle() {
      this.$refs.mychild.getMenuList()
    }
  }
}
</script>

<style lang="less" scoped>
.box-card {
  .add-btn {
    display: flex;
    justify-content: flex-end;
  }
}
</style>
